home *** CD-ROM | disk | FTP | other *** search
/ HAKERIS 11 / HAKERIS 11.ISO / linux / system / LinuxConsole 0.4 / linuxconsole0.4install-en.iso / guile0.4.lcm / share / guile / gtk-1.2 / threads.scm < prev   
Encoding:
Text File  |  2004-01-06  |  555 b   |  25 lines

  1. (define-module (gtk-1.2 threads)
  2.   :use-module (gtk-1.2 gtk)
  3.   :use-module (gtk-1.2 gdk)
  4.   :use-module (ice-9 threads))
  5.  
  6. (export gtk-threads-handler? gtk-threads-ensure-handler)
  7.  
  8. (define handler-running? #f)
  9.  
  10. (define (gtk-threads-handler?)
  11.   handler-running?)
  12.  
  13. (define (gtk-threads-ensure-handler)
  14.   (if (not handler-running?)
  15.       (begin-thread
  16.        (dynamic-wind
  17.        (lambda ()
  18.          (gdk-threads-enter)
  19.          (set! handler-running? #t))
  20.        (lambda ()
  21.          (gtk-main))
  22.        (lambda ()
  23.          (set! handler-running? #f)
  24.          (gdk-threads-leave))))))
  25.